/**
 * 严肃声明：
 * 开源版本请务必保留此注释头信息，若删除我方将保留所有法律责任追究！
 * 本软件已申请软件著作权，受国家版权局知识产权以及国家计算机软件著作权保护！
 * 可正常分享和学习源码，不得用于违法犯罪活动，违者必究！
 * Copyright (c) 2019-2021 十三 all rights reserved.
 * 版权所有，侵权必究！
 */
package ltd.newbee.mall.api.mall;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import ltd.newbee.mall.api.admin.NewBeeAdminRegisteUserAPI;
import ltd.newbee.mall.api.mall.param.PointConsumeParam;
import ltd.newbee.mall.config.annotation.TokenToMallUser;
import ltd.newbee.mall.entity.MallUser;
import ltd.newbee.mall.service.NewBeeMallUserService;
import ltd.newbee.mall.util.Result;

@RestController
@Api(value = "v1", tags = "9.新蜂商城支付相关接口")
@RequestMapping("/api/v1")
public class NewBeeMallPaymentAPI {
    private static final Logger LOGGER = LoggerFactory.getLogger(NewBeeAdminRegisteUserAPI.class);
    @Resource
    private NewBeeMallUserService newBeeMallUserService;

    @RequestMapping(value = "/payment/point/consume", method = RequestMethod.POST)
    @ApiOperation(value = "单纯积分支付", notes = "单纯积分支付")
    public Result pointGrantCancellation(@RequestBody PointConsumeParam param, @TokenToMallUser MallUser loginMallUser) {
        LOGGER.info("params:{}", param.toString());
        return newBeeMallUserService.userConsumePoint(loginMallUser.getUserId(), param.getOrderNo());
    }

}
